package com.huali.servlet;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet(name = "IndexServlet", value = "/index")
public class IndexServlet extends HttpServlet {

//    private  TestDao testDao = new TestDao();

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        String m = request.getParameter("m");
        String password = request.getParameter("password");

        switch (m) {
            case "123":
                //ctrl + alt + m
                findAll(response);
                break;
            case "456":
                getWhere(response, password);
                break;
            default:
                System.out.println("C数据");
        }
    }

    private void getWhere(HttpServletResponse response, String password) throws IOException {
//        testDao.getWhere(response);
    }

    /**
     * 查询所有数据
     *
     * @param response
     * @throws IOException
     */
    private void findAll(HttpServletResponse response) throws IOException {
        System.out.println(123);
    }


    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
